package com.everflourish.yeah100.entity.marking;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

public class Student implements Serializable {
    private static final long serialVersionUID = 1L;
    private String id; // 学生id
    private String name; // 学生名称
    private String number; // 学号
    private String userName; // 用户名
    private String email; // 邮箱
    private String phoneNo; // 手机号码
    private String status; // 状态
    private String sex; //性别  男N  女M
    private StudentAnswer answer;
    private String isReadCard;

    public String getIsReadCard() {
        return isReadCard;
    }

    public void setIsReadCard(String isReadCard) {
        this.isReadCard = isReadCard;
    }

    private String lastModifiedTime;//最后的修改时间
    //1上传中  2上传失败
    private transient Integer uploadStatus; // 上传的状态

    public Integer getUploadStatus() {
        return uploadStatus;
    }

    public void setUploadStatus(Integer uploadStatus) {
        this.uploadStatus = uploadStatus;
    }

    public StudentAnswer getAnswer() {
        return answer;
    }

    public void setAnswer(StudentAnswer answer) {
        this.answer = answer;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhoneNo() {
        return phoneNo;
    }

    public void setPhoneNo(String phoneNo) {
        this.phoneNo = phoneNo;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    /**
     * @return the lastModifiedTime
     */
    public String getLastModifiedTime() {
        return lastModifiedTime;
    }

    /**
     * @param lastModifiedTime the lastModifiedTime to set
     */
    public void setLastModifiedTime(String lastModifiedTime) {
        this.lastModifiedTime = lastModifiedTime;
    }

    /**
     * 赋值
     */
    public void copyValue(Student student) {
        this.id = student.getId();
        this.name = student.getName();
        this.number = student.getNumber();
        this.userName = student.getUserName();
        this.email = student.getEmail();
        this.phoneNo = student.getPhoneNo();
        this.status = student.getStatus();
        this.sex = student.getSex();
        this.answer = student.getAnswer();
    }

    public Object deepCopy() {
        ObjectInputStream ois;
        try {
            // 将该对象序列化成流,因为写在流里的是对象的一个拷贝，而原对象仍然存在于JVM里面。所以利用这个特性可以实现对象的深拷贝
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            ObjectOutputStream oos = new ObjectOutputStream(bos);
            oos.writeObject(this);
            // 将流序列化成对象
            ByteArrayInputStream bis = new ByteArrayInputStream(
                    bos.toByteArray());
            ois = new ObjectInputStream(bis);
            return ois.readObject();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }
}
